//
//  HeardShoppingCollectionViewCell.m
//  NineGroupProject
//
//  Created by dllo on 15/12/23.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "HeardShoppingCollectionViewCell.h"
#import "UIImageView+WebCache.h"
#import "Masonry.h"

@implementation HeardShoppingCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        [self creatSubCell];
    }
    return self;
}

-(void)creatSubCell{
    
    self.headImageView = [[UIImageView alloc]init];
    [self.contentView addSubview:self.headImageView];
    [self.headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10 * WID);
        make.top.mas_equalTo(0);
        make.size.mas_equalTo(50 * WID);
    }];
    
    self.headLabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.headLabel];
    self.headLabel.textAlignment = NSTextAlignmentCenter;
    self.headLabel.font = [UIFont systemFontOfSize:15];
    [self.headLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.equalTo(self.headImageView.mas_bottom);
        make.width.mas_equalTo(70 * WID);
        make.height.mas_equalTo(20 * HEI);
    }];
    
}

-(void)setModel:(HeadShoppingModel *)model{
    _model = model;
    self.headLabel.text = model.name;
    NSURL *url = [NSURL URLWithString:model.logo];
    [self.headImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"placeholderImage.png"]];
    
}


@end
